import service from "@/utils/request";

export function getCourseListService(params) {
  return service({
    url: "/course/list",
    method: "get",
    params,
  });
}

export function getCourseDetailService(courseId) {
  return service({
    url: "/course/detail",
    method: "get",
    params: { courseId },
  });
}

export function getCourseListForSaleService(params) {
  return service({
    url: "/course/courseListForSale",
    method: "get",
    params,
  });
}

export function buyCourse(courseId) {
  const params = {
    courseId,
  };
  return service({
    url: "/course/buyCourse",
    method: "put",
    params,
  });
}

export function getPurchasedCourseListService(params) {
  return service({
    url: "/course/purchasedCourseList",
    method: "get",
    params,
  });
}


export function haveYouPurchased(courseId) {
  return service({
    url: "/course/haveYouPurchased",
    method: "get",
    params: { courseId } // 将 courseId 添加到查询参数中
  });
}

export function getClassroomCourseListService(params) {
  return service({
    url: "/course/classroomCourseList",
    method: "get",
    params,
  });
}